package Leetcode;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;

public class problem11 {
    public int maxArea(int[] height) {
        if(height.length < 2){
            return 0;
        }

        int max = Integer.MIN_VALUE;
        int i = 0;
        int j = height.length - 1;

        while(i < j){
            //int hight = arr[i] >= arr[j] ? j-- : i++;
            max = Math.max(max, (j - i) * height[height[i] >= height[j] ? j-- : i++]);
        }
        return max;
    }
}
